package com.by.mapper;

import com.by.bean.Member;
import org.apache.ibatis.annotations.*;

public interface MemberMapper {
    /**
     * 根据id查询会员及商家信息
     *
     * @param id 会员id
     * @return
     */


    @Results(
            {
                    @Result(property = "id", column = "id"),
                    @Result(property = "account", column = "account"),
                    @Result(property = "password", column = "password"),
                    @Result(property = "name", column = "name"),
                    @Result(property = "business", column = "id", one = @One(select = "com.by.mapper.BusinessMapper.queryByMid"))
            }
    )
    @Select(" SELECT m.id,\n" +
            "               m.account,\n" +
            "               m.`password`,\n" +
            "               m.`name`\n" +
            "        FROM member m\n" +
            "        WHERE m.id = #{id}")
    Member getById(int id);


}
